<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><s:text name="title"/></title>
<link href="<%=request.getContextPath()%>/stage/css/inside.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/stage/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/stage/js/ajaxfileupload.js"></script>
<script type="text/JavaScript">
<!--
$(document).ready(function() {
	$(".right_bottom li").height(30);
	$("#showdiv").show();
	$("#editdiv").hide();
	$("#passspan").hide();
})
function showoredit(){
	$("#showdiv").toggle();
	$("#editdiv").toggle();
}
function editpass(){
	$("#passspan").toggle();
}

function upuser(){
//	var username=$("#username").val();
//	if(username.length<4||username.length>10){
//		alert('请输入合法用户名长度，区间为4-10.');
//		return false;
//	}
	return true;
}
function uppass(){ 
	$("#mess").html('');
	var oldpass=$("#oldpass").val();
	var newpass=$("#newpass").val();
	var surepass=$("#surepass").val();
	if(oldpass==''||newpass==''||surepass==''){
		$("#mess").html('请输入原始密码,新置密码及确认密码 .');
		return false;
	}
	if(newpass != surepass){
		$("#mess").html('新置密码与确认密码必须一致.');
		return false;
	}

    var server ="<%=request.getContextPath()%>/uppass.action";
	$.post(server,{oldpass:$("#oldpass").val(),newpass:$("#newpass").val(),surepass:$("#surepass").val()},callback,"json");   
}
function upsonpass(){ 
	$("#mess").html('');
	var newpass=$("#newsonpass").val();
	var surepass=$("#suresonpass").val();
	var subUserId = document.getElementById("subUserId").value;
	if(newpass.length<4||surepass.length<4){
		$("#mess").html('请输入新置密码及确认密码,不少于4位 .');
		return false;
	}
	if(newpass != surepass){
		$("#mess").html('新置密码与确认密码必须一致.');
		return false;
	}

    var server ="<%=request.getContextPath()%>/upsonpass.action";
	$.post(server,{newpass:$("#newsonpass").val(),surepass:$("#suresonpass").val(),subUserId : subUserId},callback,"json");   
}
function callback(json){ 
	var obj = eval( "("+json.json+")" );
	$("#oldpass").val('');
	$("#newpass").val('');
	$("#surepass").val('');
   	if(obj.success){
   		$("#mess").html('密码更新成功.');//显示反馈信息  
   	}else{
   	 	$("#mess").html('密码更新失败,原始密码错误');//显示反馈信息  
   	}
}

function searchSubUser() {
	var server = "<%=request.getContextPath()%>/searchSubUser.action";
	$.post(server,callback1,"json");
	alert("sss");
}

function callback1() {
	var list = eval(json.json);
//	log.dir(list);
}

//-->
</script>
</head>

<body
	onload="MM_preloadImages('<%=request.getContextPath()%>/stage/images/menu0_01.jpg','<%=request.getContextPath()%>/stage/images/menu0_02.jpg','<%=request.getContextPath()%>/stage/images/menu0_03.jpg','<%=request.getContextPath()%>/stage/images/menu0_04.jpg','<%=request.getContextPath()%>/stage/images/menu0_05.jpg','<%=request.getContextPath()%>/stage/images/menu0_06.jpg','<%=request.getContextPath()%>/stage/images/menu0_07.jpg')">
<div class="mainbody">
<%@ include file="head1.jsp"%>
 <div class="intermediate">
    <h1>当前位置：首页&nbsp;&gt;&nbsp;<b><FONT COLOR="#FFCC66">用户管理</FONT></b></h1>
    <%@ include file="left_user.jsp"%>
     <div class="right">
	    <h4><img src="<%=request.getContextPath()%>/stage/images/user/01.jpg" /></h4>
	    <div class="right_bottom" id="showdiv">
		  <ul>
		  	<li><a style="cursor:pointer;color:yellow" onclick="showoredit()">修改/隐藏</a></li>
			<li><span style="width:100px;">用户名称：</span><s:property value="userBo.userName"/></li>
			<li>公司logo：<s:if test="userBo.logo!=null"><s:text name="web_pic"/>/<s:property value="userBo.logo"/></s:if></li>
			<li>首页图片：<s:if test="userBo.bigPic!=null"><s:text name="web_pic"/>/<s:property value="userBo.bigPic"/></s:if></li>
			<li>页头图片：<s:if test="userBo.smallPic!=null"><s:text name="web_pic"/>/<s:property value="userBo.smallPic"/></s:if></li>
			<li>公司名称：<s:property value="userBo.cmpName"/></li>
			<li>公司地址：<s:property value="userBo.cmpAddress"/></li>
			<li>品牌名称：<s:property value="userBo.brandName"/></li>
			<li>电子邮件：<s:property value="userBo.email"/></li>
			<li>联系人名：<s:property value="userBo.contact"/></li>
			<li>联系电话：<s:property value="userBo.contactTel"/></li>
			<li>公司电话：<s:property value="userBo.cmpTel"/></li>
			<li>公司传真：<s:property value="userBo.cmpFax"/></li>
			<li>邮寄地址：<s:property value="userBo.postAddress"/></li>
			<li>所属区域：<s:property value="userBo.area"/></li>
			<li>营业执照：<s:property value="userBo.license"/></li>
			<li>税务登记：<s:property value="userBo.taxRegistration"/></li>
		  </ul>
	   </div>
	   <div class="right_bottom" id="editdiv">
	   	  <form onsubmit="return upuser()" action="<%=request.getContextPath()%>/upuser.action" method="post" enctype="multipart/form-data">
		  <ul>
		  	<li><a style="cursor:pointer;color:yellow" onclick="showoredit()">修改/隐藏</a></li>
		  	
			<li>用户名称：<s:property value="userBo.userName"/>
						<input name="userBo.userName" id="username" value="<s:property value="userBo.userName"/>" type= "hidden" class="sous1"  />
			</li>
			<li>公司logo：<s:text name="web_pic"/>/<s:property value="userBo.logo"/></li>
			<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="file" name="logo" id="logo"/><span id="logomess">宽长为267*75</span>
			</li>
			<li>首页图片：<s:text name="web_pic"/>/<s:property value="userBo.bigPic"/></li>
			<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="file" name="bpic" id="bpic"/></li>
			<li>页头图片：<s:text name="web_pic"/>/<s:property value="userBo.smallPic"/></li>
			<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="file" name="spic" id="spic"/></li>
			<li>公司名称：<input name="userBo.cmpName" value="<s:property value="userBo.cmpName"/>" type="text" class="sous1"/></li>
			<li>公司地址：<input name="userBo.cmpAddress" value="<s:property value="userBo.cmpAddress"/>" type="text" class="sous1"/></li>
			<li>品牌名称：<input name="userBo.brandName" value="<s:property value="userBo.brandName"/>" type="text" class="sous1"/></li>
			<li>电子邮件：<input name="userBo.email" value="<s:property value="userBo.email"/>" type="text" class="sous1"/></li>
			<li>联系人名：<input name="userBo.contact" value="<s:property value="userBo.contact"/>" type="text" class="sous1"/></li>
			<li>联系电话：<input name="userBo.contactTel" value="<s:property value="userBo.contactTel"/>" type="text" class="sous1"/></li>
			<li>公司电话：<input name="userBo.cmpTel" value="<s:property value="userBo.cmpTel"/>" type="text" class="sous1"/></li>
			<li>公司传真：<input name="userBo.cmpFax" value="<s:property value="userBo.cmpFax"/>" type="text" class="sous1"/></li>
			<li>邮寄地址：<input name="userBo.postAddress" value="<s:property value="userBo.postAddress"/>" type="text" class="sous1"/></li>
			<li>所属区域：<input name="userBo.area" value="<s:property value="userBo.area"/>" type="text" class="sous1"/></li>
			<li>营业执照：<input name="userBo.license" value="<s:property value="userBo.cmpAddress"/>" type="text" class="sous1"/></li>
			<li>税务登记：<input name="userBo.taxRegistration" value="<s:property value="userBo.taxRegistration"/>" type="text" class="sous1"/></li>
			<li style="width:200px; padding-left:150px;">
				<input type="hidden" name="userBo.userId" value="<s:property value="userBo.userId"/>"/>
				<input type="hidden" name="userBo.userType" value="<s:property value="userBo.userType"/>"/>
				<input type="hidden" name="userBo.password" value="<s:property value="userBo.password"/>"/>
				<input type="hidden" name="userBo.logo" value="<s:property value="userBo.logo"/>"/>
				<input type="hidden" name="userBo.bigPic" value="<s:property value="userBo.bigPic"/>"/>
				<input type="hidden" name="userBo.smallPic" value="<s:property value="userBo.smallPic"/>"/>
				<input type="hidden" name="userBo.registerDate" value="<s:property value="userBo.registerDate"/>"/>
				<input type="hidden" name="userBo.parentAgentId" value="<s:property value="userBo.parentAgentId"/>"/>
				<input type="hidden" name="userBo.parentDealerId" value="<s:property value="userBo.parentDealerId"/>"/>
				<input type="hidden" name="userBo.addressee" value="<s:property value="userBo.addressee"/>"/>
				<input type="hidden" name="userBo.addresseeTel" value="<s:property value="userBo.addresseeTel"/>"/>
				<input type="image" src="<%=request.getContextPath()%>/stage/images/common/submit.gif"/>
			</li>
			<li><a style="cursor:pointer;color:yellow" onclick="editpass()">修改/隐藏密码</a></li>
			<span id="passspan">
			 <li>用户密码</li>
			<li>
				原始密码：<input name="oldpass" id="oldpass" type="password" class="kuang" />&nbsp;&nbsp;
				新置密码：<input name="newpass" id="newpass" type="password" class="kuang" />&nbsp;&nbsp;
				确认密码：<input name="surepass" id="surepass" type="password" class="kuang" />&nbsp;&nbsp;
				<a style="cursor:pointer;color:yellow" onclick="uppass()">提交修改</a>
			</li>
			  <li>子用户密码</li>
			  <li>
			  	选择子用户：
			 	<s:select id="subUserId" name = "subUserId" list="dataList" listKey="userId" listValue="userName" headerKey="0" headerValue="全部子用户" cssClass="selKuang" theme="simple"></s:select> 	
        		&nbsp;&nbsp;
				新置密码：<input name="newsonpass" id="newsonpass" type="password" class="kuang" />&nbsp;&nbsp;
				确认密码：<input name="suresonpass" id="suresonpass" type="password" class="kuang" />&nbsp;&nbsp;
				<a style="cursor:pointer;color:yellow" onclick="upsonpass()">提交修改</a>
			</li>
			<li>提示:<span id="mess"></span></li>
			</span>
		  </ul>
		  </form>
	   </div>
	 </div>
 </div>
<%@ include file="foot.jsp"%>
</div>
</body>
</html>
